import Vue from 'vue';
import confirm from './rm-fieldsort.vue';

let ConfirmConstructor = Vue.extend(confirm);
let rm_fieldsort = function(text) {
    return new Promise((res, rej) => { //promise封装，confirm执行res，cancel执行rej
        let confirmDom = new ConfirmConstructor({
            el: document.createElement('div')
        })
        document.body.appendChild(confirmDom.$el); //new一个对象插入body里面
        console.log(text);
        confirmDom.ColumnOption = text.tableColumn;
        confirmDom.tableDates = text.sortArr;
        confirmDom.issuccess = function() {
            res({
                data: confirmDom.tableDates
            })
            confirmDom.isShow = false;
        }
    })
}
export default rm_fieldsort;